package com.teamone.monopoly.domain;

import java.util.ArrayList;
import java.util.List;

public class Board {

	public static final int TOTAL_SQUARE_NUMS = 40;
	public static final Square JAILSQUARE = new SimpleSquare();
	List<Square> squares = new ArrayList<Square>(TOTAL_SQUARE_NUMS);
	
	public Board() {
		for (int i=0; i<TOTAL_SQUARE_NUMS; i++) {
			switch (i)
			{
				case 0:
					squares.add(new GoSquare());
					break;
				case 5:
					squares.add(new TaxSquare());
					break;
				case 9:
					squares.add(JAILSQUARE);
					break;
				case 29:
					squares.add(new GoToJailSquare());
					break;
				default:
					squares.add(new SimpleSquare());
			}
		}
	}
	
	public Square getSquare(Square square, int i) {
		int newPos = (i + squares.indexOf(square)) % TOTAL_SQUARE_NUMS;
		return squares.get(newPos);
	}

	public Square firstSquareInBoard() {
		return squares.get(0);
	}

}
